package com.fs.ibox_h.dao.impl;

import com.fs.ibox_h.dao.TypeDao;
import com.fs.ibox_h.pojo.Type;
import com.fs.ibox_h.util.JDBCUtil;

import java.util.List;

/**
 * Author:HOU
 * date:2022/11/19  20:03
 * 案例:
 **/
public class TypeDaoimpl implements TypeDao {
    @Override
    public List<Type> selectAll() {
        String sql="SELECT * FROM tb_type";
        List<Type> types = JDBCUtil.executeQuery(sql, Type.class);
        return types;
    }

    @Override
    public void addtype(String name) {
        String sql="INSERT INTO tb_type (name) VALUES (?)";
        int i = JDBCUtil.executeUpdate(sql,name);

    }

    @Override
    public void del(String name) {
        String sql="DELETE From tb_type where name=?";
        int i = JDBCUtil.executeUpdate(sql,name);
    }
}
